home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / _GUICtrlStatusBarSetParts.au3 < prev    next >
Text File  |  2007-09-08  |  2KB  |  58 lines

  1. Opt("MustDeclareVars", 1)
  2. #include <GUIConstants.au3>
  3. #Include <GuiStatusBar.au3>
  4.  
  5. ;================================================================
  6. ; Example 1 - Using AutoIt Control
  7. ;================================================================
  8. _Main()
  9.  
  10. Func _Main()
  11.     Local $a_PartsRightEdge[3] = [150, 300, -1]
  12.     Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]
  13.     Local $a_PartsRightEdge2[2] = [100, -1]
  14.     Local $gui, $input, $Button_1, $Button_2, $Button_3, $Button_4, $StatusBar1, $msg
  15.     $gui = GUICreate("Status Bar - Parts", 500, -1, -1, -1, $WS_SIZEBOX)
  16.     $input = GUICtrlCreateInput("", 10, 10, 120, 20, $ES_NUMBER)
  17.     $Button_1 = GUICtrlCreateButton("<-- Create", 140, 10, 100)
  18.     $Button_2 = GUICtrlCreateButton("3 Parts", 10, 40, 100, 20)
  19.     $Button_3 = GUICtrlCreateButton("2 Parts", 10, 70, 100, 20)
  20.     $Button_4 = GUICtrlCreateButton("3 Parts", 10, 100, 100, 20)
  21.     $StatusBar1 = _GUICtrlStatusBarCreate($gui, $a_PartsRightEdge, $a_PartsText)
  22.     GUISetState(@SW_SHOW)
  23.     _GUICtrlStatusBarSetParts($gui, $StatusBar1, $a_PartsRightEdge2) ; force an error, param 2 can not be an array
  24.     If @error Then _GUICtrlStatusBarSetText($StatusBar1, "Error: " & @error, 0)
  25.  
  26.     While 1
  27.         $msg = GUIGetMsg()
  28.         Select
  29.             Case $msg = $GUI_EVENT_RESIZED
  30.                 _GUICtrlStatusBarResize($StatusBar1)
  31.             Case $msg = $GUI_EVENT_CLOSE
  32.                 ExitLoop
  33.             Case $msg = $Button_1
  34.                 If StringLen(GUICtrlRead($input)) Then _GUICtrlStatusBarSetParts($gui, $StatusBar1, Number(GUICtrlRead($input)))
  35.             Case $msg = $Button_2
  36.                 _GUICtrlStatusBarSetParts($gui, $StatusBar1, 3, $a_PartsRightEdge)
  37.             Case $msg = $Button_3
  38.                 _GUICtrlStatusBarSetParts($gui, $StatusBar1, 5, $a_PartsRightEdge2) ; number of parts is larger than array, parts = size of array
  39.             Case $msg = $Button_4
  40.                 _GUICtrlStatusBarSetParts($gui, $StatusBar1, -1, $a_PartsRightEdge) ; number of parts is smaller than array, parts = size of array
  41.         EndSelect
  42.     WEnd
  43.     GUIDelete()
  44. EndFunc   ;==>_Main
  45.  
  46. ;================================================================
  47. ; Example 2 - External Control
  48. ;================================================================
  49. _External()
  50.  
  51. Func _External()
  52.     Opt("WinTitleMatchMode", 4)
  53.     Local $h_win = WinGetHandle("classname=SciTEWindow")
  54.     Local $h_status = ControlGetHandle($h_win, "", "msctls_statusbar321")
  55.     _GUICtrlStatusBarSetParts($h_win, $h_status, 3)
  56.     Sleep(10000)
  57.     _GUICtrlStatusBarSetParts($h_win, $h_status, 1)
  58. EndFunc   ;==>_External